﻿@{
    ViewBag.Title = "修改密码";
    Layout = "~/Views/Shared/_Index.cshtml";
}


<div style="padding-top: 20px; margin-right: 30px;">
    @*<div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建用户</a>
        </div>
    </div>*@

    <table class="form">
        <tr>
            <th class="formTitle">用户名</th>
            <td class="formValue" colspan="3">
                <span id="F_Account" name="F_Account">@ViewData["username"]</span>
            </td>
        </tr>
        <tr>
            <th class="formTitle">旧密码</th>
            <td class="formValue" colspan="1">
                <input id="F_UserPasswordOld" name="F_UserPasswordOld" type="password" class="form-control required" placeholder="请输入密码"/>
            </td>
        </tr>
        <tr>

            <th class="formTitle">密码</th>
            <td class="formValue" colspan="1">
                <input id="F_UserPassword" name="F_UserPassword" type="password" class="form-control required" placeholder="请输入密码"/>
            </td>
        </tr>
        <tr>

            <th class="formTitle">确认密码</th>
            <td class="formValue" colspan="1">
                <input id="F_UserPassword1" name="F_UserPassword1" type="password" class="form-control required" placeholder="请输入确认密码"/>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <div class="layui-layer-btn">
                    <a class="layui-layer-btn0 btn btn-primary" style="float: right" onclick="ChangePassword()">确认</a>
                </div>
            </td>
        </tr>
        
    </table>
</div>

<script type="text/javascript">
    
    $(function () {
        
    });

    function ChangePassword() {
        if ($("#F_UserPassword").val() != $("#F_UserPassword1").val()) {
            alert("密码与确认密码不一致请重新输入！");
            return;
        }
        var param = { oldPassword: $("#F_UserPasswordOld").val(), newPassword: $("#F_UserPassword").val() };
        console.log(JSON.stringify(param));
        $.submitForm({
            url: "/Home/ChangePassword",
            param: param,
            success: function () {
                $("#F_UserPasswordOld").val("");
                $("#F_UserPassword").val("");
                $("#F_UserPassword1").val("");
            }
        });
        
    }

</script>
